import { Component, OnInit } from '@angular/core';

import * as $ from 'jquery';
import Swiper from 'swiper';
// import amazeui from 'amazeui';

// declare var $: any;


@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    let timer;

    // 首页
    // 搜索显示隐藏
    $(function () {
      $("#input1").mousedown(
        function () {
          $(".search_bomb_box").show()
          $("#waik").hide()
        }
      )
      $(".search_bomb_box .search_top>a").mousedown(
        function () {
          $(".search_bomb_box").hide()
          $("#waik").show()
        }
      )
    })

    // banner
    var swiper = new Swiper('.banner_shouy', {
      pagination: {
        el: '.lunbo_banner',
      },
      observer: true,
      observeParents: true,
      autoplay: true
    });

    // 快捷导航
    var swiper = new Swiper('.nav_iconbox', {
      pagination: {
        el: '.icon01',
      },
      speed: 500,
      // autoplayDisableOnInteraction: false,
    });

    //  平台公告

    $(document).ready(function () {
      //滚动文字
      function runtxt() {
        $(".scrollnews ul").animate({ marginTop: "-.4rem" }, 300,
          function () {
            $(".scrollnews ul li:last").after($(".scrollnews ul li:first"))
            $(".scrollnews ul").css("margin-top", 0)
          }
        )
      }
      $(".scrollnews ul li a").mouseenter(
        function () {
          clearInterval(timer)
        }
      )
      $(".scrollnews ul li a").mouseleave(
        function () {
          timer = setInterval(runtxt, 4000)
        }
      )
      timer = setInterval(runtxt, 4000)
    })
  }

}
